Socket
Socket
Sign inDemoInstall

@popmotion/popcorn

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@popmotion/popcorn

Utility functions for animation and interactions.


Version published
Weekly downloads
96K
decreased by-11.92%
Maintainers
1
Weekly downloads
 
Created

What is @popmotion/popcorn?

@popmotion/popcorn is a collection of utility functions for creating animations and handling various types of motion in JavaScript. It provides a range of tools for easing, interpolation, and other motion-related calculations.

What are @popmotion/popcorn's main functionalities?

Easing Functions

Easing functions are used to create smooth transitions between values. @popmotion/popcorn provides several easing functions like easeIn, easeOut, and easeInOut to help create natural motion effects.

const { easeIn, easeOut, easeInOut } = require('@popmotion/popcorn');

const start = 0;
const end = 100;
const progress = 0.5;

console.log(easeIn(progress) * (end - start) + start); // Ease-in calculation
console.log(easeOut(progress) * (end - start) + start); // Ease-out calculation
console.log(easeInOut(progress) * (end - start) + start); // Ease-in-out calculation

Interpolation

Interpolation allows you to map a range of input values to a range of output values. This is useful for creating animations that need to transition between different states.

const { interpolate } = require('@popmotion/popcorn');

const inputRange = [0, 1];
const outputRange = [0, 100];
const interpolator = interpolate(inputRange, outputRange);

console.log(interpolator(0.5)); // Interpolates to 50

Spring Calculations

Spring calculations simulate the physics of a spring, providing a natural and dynamic way to animate elements. The spring function takes a configuration object and returns a function that calculates the spring value at a given progress.

const { spring } = require('@popmotion/popcorn');

const springConfig = { stiffness: 100, damping: 10, mass: 1 };
const springValue = spring(springConfig);

console.log(springValue(0.5)); // Calculates spring value at progress 0.5

Other packages similar to @popmotion/popcorn

Keywords

FAQs

Package last updated on 30 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc